//
//  SmsCloudCityTableCell.m

#import "SmsCloudCityTableCell.h"

static NSString * SmsCloudCityTableCellId = @"SmsCloudCityTableCellId";
@interface SmsCloudCityTableCell()
@property (nonatomic,strong) UIView * smsCloudTableView;
@property (nonatomic,strong) UIImageView *smsCloudCityImgView;
@property (nonatomic,strong) UILabel *smsCloudTitleLab;
@property (nonatomic,strong) UIView *smsCloudLineView;
@end
@implementation SmsCloudCityTableCell
+ (instancetype)smsCloudCityTableCell:(UITableView *)tableView{
    SmsCloudCityTableCell * smsCountyTableCell = [tableView dequeueReusableCellWithIdentifier:SmsCloudCityTableCellId];
    if (!smsCountyTableCell) {
        smsCountyTableCell = [[SmsCloudCityTableCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:SmsCloudCityTableCellId];
    }
    smsCountyTableCell.backgroundColor = [UIColor clearColor];
    smsCountyTableCell.selectionStyle = UITableViewCellSelectionStyleNone;
    smsCountyTableCell.accessoryType = UITableViewCellAccessoryNone;
    return smsCountyTableCell;
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self == [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self makeSubView];
    }
    return self;
}
- (void)makeSubView{
    self.smsCloudTableView = [[UIView alloc] init];
    self.smsCloudTableView.backgroundColor = UIColor.clearColor;
    [self.contentView addSubview:self.smsCloudTableView];
    [self.smsCloudTableView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(@([SmsCloudHead SmsCloudScreewRatio:24]));
        make.right.equalTo(@(-[SmsCloudHead SmsCloudScreewRatio:24]));
        make.top.equalTo(@([SmsCloudHead SmsCloudScreewRatio:0]));
        make.bottom.equalTo(@([SmsCloudHead SmsCloudScreewRatio:0]));
    }];
    self.smsCloudCityImgView = [[UIImageView alloc] init];
    [self.smsCloudTableView addSubview:self.smsCloudCityImgView];
    [self.smsCloudCityImgView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(@([SmsCloudHead SmsCloudScreewRatio:3]));
        make.centerY.equalTo(self.smsCloudTableView);
        make.height.equalTo(@([SmsCloudHead SmsCloudScreewRatio:48]));
        make.width.equalTo(@([SmsCloudHead SmsCloudScreewRatio:48]));
    }];
    self.smsCloudTitleLab = [[UILabel alloc] init];
    self.smsCloudTitleLab.textColor = [SmsCloudHead SmsCloudColorHexString:@"#333333"];
    self.smsCloudTitleLab.font = [UIFont systemFontOfSize:[SmsCloudHead SmsCloudScreewRatio:28] weight:UIFontWeightMedium];
    [self addSubview:self.smsCloudTitleLab];
    [self.smsCloudTitleLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.smsCloudCityImgView.mas_right).offset([SmsCloudHead SmsCloudScreewRatio:4]);
        make.centerY.equalTo(self.smsCloudTableView);
        make.height.equalTo(@([SmsCloudHead SmsCloudScreewRatio:38]));
    }];
    self.smsCloudLineView = [[UIView alloc] init];
    self.smsCloudLineView.backgroundColor = [SmsCloudHead SmsCloudColorHexString:@"#FFFFFF" withAlpha:0.1];
    [self addSubview:self.smsCloudLineView];
    [self.smsCloudLineView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(@([SmsCloudHead SmsCloudScreewRatio:0]));
        make.right.equalTo(@(-[SmsCloudHead SmsCloudScreewRatio:0]));
        make.height.equalTo(@([SmsCloudHead SmsCloudScreewRatio:2]));
        make.bottom.equalTo(@([SmsCloudHead SmsCloudScreewRatio:0]));
    }];
}
-(void)setSmsCloudCityMdl:(SmsCloudCityModel *)smsCloudCityMdl{
    _smsCloudCityMdl = smsCloudCityMdl;
    if(_smsCloudCityMdl){
        [self.smsCloudCityImgView sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"https://www.ydl.cool/img/static/guojia/guojia01/%@.png",_smsCloudCityMdl.info.code]] placeholderImage:[SmsCloudHead SmsCloudImageNamed:@"smsCloudLogo"]];
        self.smsCloudTitleLab.text = [NSString stringWithFormat:@"%@ +%@",_smsCloudCityMdl.info.name,_smsCloudCityMdl.info.number];
    }
}
//-(void)setCountyMdl:(SMCountModel *)countyMdl{
//    _countyMdl = countyMdl;
//    if(_countyMdl){
//        [self.smsCountyImgView sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"https://www.ydl.cool/img/static/guojia/guojia01/%@.png",_countyMdl.info.code]]];
//        self.smsCountyTitleLab.text = [NSString stringWithFormat:@"%@ +%@",_countyMdl.info.name,_countyMdl.info.number];
//    }
//}
@end
